﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;

public partial class Register : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        //Fill dropdown list with countries -> sql! 
        //ddl_Country.date

    }

    protected void CreateUserWizard1_CreatedUser1(object sender, EventArgs e)
    {
        //Get ID
        MembershipUser user = Membership.GetUser(CreateUserWizard1.UserName);
        //Insert empty record
        
        DVDTableAdapters.CustomerTableAdapter ta = new DVDTableAdapters.CustomerTableAdapter();
        ta.Insert((Guid)user.ProviderUserKey,"", "", "", "", "","", 0, 0, System.DateTime.Now,false,false);
    }
    protected void CreateUserWizard1_ActiveStepChanged(object sender, EventArgs e)
    {
        if (CreateUserWizard1.ActiveStep.Title == "Complete")
        {
            MembershipUser user = Membership.GetUser(CreateUserWizard1.UserName);
            DVDTableAdapters.CustomerTableAdapter ta = new DVDTableAdapters.CustomerTableAdapter();
            ta.Update(Convert.ToString(CreateUserWizard1.UserName),txt_FirstName.Text, txt_LastName.Text, txt_Street.Text, txt_City.Text,txt_Country.Text,Convert.ToInt32(txt_Postcode.Text), Convert.ToInt32(txt_Phone.Text), Convert.ToDateTime(txt_DateOfBirth.Text),false,false,(Guid)user.ProviderUserKey);
        }
    }
}